package com.component.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.component.domain.base.DataBase;
import com.component.service.MMenuService;
import com.system.config.SpringContextUtils;
import lombok.Data;

/**
 * 
 * @TableName m_menu
 */
@TableName(value ="m_menu")
@Data
public class MMenu extends DataBase implements Serializable {
    /**
     * 主键id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 父id
     */
    private String pid;

    /**
     * 菜单名称
     */
    private String menuName;

    /**
     * 菜单访问地址
     */
    private String menuUrl;

    /**
     * 菜单层级
     */
    private Integer menuLevel;

    /**
     * 菜单组件
     */
    private String menuComponent;

    /**
     * 菜单路径
     */
    private String menuPath;

    /**
     * 
     */
    private Integer version;

    /**
     * 
     */
    private Integer deleted;

    /**
     * 
     */
    private Date createtime;

    /**
     * 
     */
    private Date updatetime;

    /**
     * 选中标识
     */
    private String activeindex;

    @TableField(exist = false)
    private MMenu parent;

    /**
     * 子菜单
     */
    @TableField(exist = false)
    private List<MMenu> mMenuChildren;

    public MMenu getParent() {
        if(this.pid!=null){
            MMenuService mMenuService=SpringContextUtils.getBean(MMenuService.class);
            this.parent=mMenuService.getById(this.pid);
        }
        return parent;
    }

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}